1. Field of the Invention
The present invention relates to a numerical controller that enables a sub program call and a numerical control method thereof.
2. Description of the Related Art
A numerical controller that controls a machine tool includes a sub program call function and a macro call function.
<Sub Program Call and Macro Call>
A sub program is a program in which a certain fixed operation and/or an operation performed in a repeated manner is registered. With a sub program call used in a main program, the writing of a program can be simplified. Furthermore, a macro call is a function with which an argument can be specified for a sub program, whereby a call with higher versatility is achieved.
FIG. 1 is an example of a sub program call and FIG. 2 is an example of a macro call. In FIG. 2, “A1.0” and “B2.0” in a G65 block are passed to O9010 as arguments and used as variables such as macro variables #1 and #2. A macro call using G65 is called a simple call. A macro call similar to the one with G65, performed using a G code registered in advance (not illustrated), is called a macro call using a G code.
A numerical controller that controls a machine tool also includes a function to stop execution of a program in the middle of the execution of the program to perform an operation check of the program (single block operation function, function to stop in accordance with sequence number specification).
<Single Block Operation>
FIG. 3 is a diagram illustrating a single block operation. A single block operation is a function to execute one block of a program for each startup of automatic operation before stopping the automatic operation. This enables an easy operation check of a program. In a single block operation, when a workpiece 2 is machined using a tool 3, the tool 3 is stopped in each of the positions of a stop 4, a stop 5, and a stop 6 and the next block is executed in accordance with a command.
However, there is a problem that checks become troublesome because a stop is made in every block while the function of this single block operation is effective.
<Stop in Accordance with Sequence Number Specification>
FIG. 4 is a diagram illustrating a stop in accordance with sequence number specification. A stop in accordance with sequence number specification is a function to stop automatic operation when a block is executed that corresponds to a program number and a sequence number preset prior to operation of a program. This enables an easy operation check of a program. In the example illustrated in FIG. 4, a sub program O0010 is called by a block written as “M98P0010” in a main program O0001. A block written as “N20 G04 P500;” in the sub program O0010 is a block commanding a stop (dwell) of 0.5 seconds, which is specified by a block N20 in the main program O0001 as a block for stop in accordance with a sequence number.
However, there is a problem that checks at stops become troublesome for a common sub program called by many programs because stops are always made at specified points regardless of the program calling method.